class Solution {//leetcode179——最大数
private:
    class comp{
    public:
        bool operator()(int& lhs,int& rhs){
            string l=to_string(lhs);
            string r=to_string(rhs);
            string ls=l+r;
            string rs=r+l;
            return (ls.compare(rs)>0);
        }
    };
public:
    string largestNumber(vector<int>& nums) {
        vector<string> strs;
        for(auto x:nums){
            strs.push_back(to_string(x));
        }
        sort(strs.begin(),strs.end(),[](string& lhs,string& rhs)->bool{
            return lhs+rhs>rhs+lhs;
        });
        string ret;
        for(auto &str:strs){
            ret+=str;
        }
        if(ret[0]=='0') return "0";
        return ret;
    }
};